<!DOCTYPE html>
<html>
<head>
	<!-- 设置浏览器不缓存 -->
    <META CONTENT="no-cache" HTTP-EQUIV="pragma">
    <META CONTENT="no-cache, must-revalidate" HTTP-EQUIV="Cache-Control">
    <META CONTENT="0" HTTP-EQUIV="expires">
	<!-- Content-Type -->
	<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
	<meta content="yes" name="apple-mobile-web-app-capable">
	<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
	<!-- Favicon -->
	<link href="./images/logo.png" rel="shortcut icon">
	<title>企业服务共享中心-发票库存</title>
	<!--stylesheets-->
	<link href="./plugins/element/index.css" rel="stylesheet">
	<script src="./plugins/vue/vue.js"></script>
	<script src="./plugins/element/index.js"></script>
	<script src="./plugins/axios/axios.min.js"></script>
	<script src="./js/common/public.js?v=0.8.0.3"></script>
	<!-- 自定义样式表 -->
	<link href="./css/base.css?v=0.8.0.3" rel="stylesheet"/>
</head>
<body >
<div id="app">
<template>
<el-container class="maincontainer">
	<el-container class="submaincontainer">
		<el-card class="box-card" shadow="never" style="position:relative;width:330px" v-show="leftbar_show">
		  <div style="position:absolute;left:0;top:0;right:0;bottom:0;overflow-y:auto;overflow-x:hidden;padding-left: 20px;padding-top: 20px;padding-right: 20px;">
			<el-form >
				<el-form-item label="关键字查询" >
					<el-input placeholder="档案号|公司名称|备注" v-model="queryForm.keyword" clearable></el-input>
				</el-form-item>

				<el-form-item label="托管">
					<el-select v-model="queryForm.remake" placeholder="请选择" clearable>
						<el-option value="UK托管"> </el-option>
						<el-option value="白盘托管"> </el-option>
						<el-option value="黑盘托管"> </el-option>
						<el-option value="托管无盘"> </el-option>
						<el-option value="有盘不托管"> </el-option>
						<el-option value="无盘"> </el-option>
					</el-select>
				</el-form-item>
				<el-form-item label="发票章" prop="invoice_seal">
					<el-select v-model="queryForm.invoice_seal" placeholder="请选择" clearable>
						<el-option label="公司保管" value="公司保管"> </el-option>
						<el-option label="客户保管" value="客户保管"> </el-option>
					</el-select>
				</el-form-item>
				<el-form-item label="发票最低提醒数量">
					<el-input oninput="value=value.replace(/[^\d]/g,'')" v-model="queryForm.policeNumber" clearable></el-input>
				</el-form-item>
				<el-form-item label="状态">
					<el-select v-model="queryForm.status" placeholder="请选择" clearable>
						<el-option label="正常" value="正常"> </el-option>
						<el-option label="停止" value="停止"> </el-option>
						<el-option label="公司名不存在" value="公司名不存在"> </el-option>
					</el-select>
				</el-form-item>
				<el-form-item label="日期" prop="billing_time" >
						<el-date-picker style="width:235px"
							value-format="yyyy-MM-dd"
							  v-model="queryForm.billing_time"
							  type="daterange"
							  width="100"
							  align="right"
							  unlink-panels
							  range-separator="至"
							  start-placeholder="开始日期"
							  end-placeholder="结束日期"
							  :picker-options="pickerOptions">
						</el-date-picker>
					</el-form-item>
				<el-form-item>
				<el-button @click.native.prevent="start" size="small" style="position:fixed;left:20px;bottom:5px;" type="primary">查询</el-button>
				</el-form-item>
			</el-form>
		  </div>
		</el-card>
		<el-card class="box-card" shadow="never" style="width:100%">
			<div class="clearfix" slot="header">
				<i style="color:#409EFF;cursor:pointer;" v-bind:class="[leftbar_show ? 'el-icon-s-fold' : 'el-icon-s-unfold']" v-on:click="showLeftBar()"></i>
				<span>发票库存</span>
				<el-button-group style="float: right;margin-top:0px;">
					<el-tooltip class="item" effect="dark" content="导入" placement="top-start">
						<el-button size="small" icon="el-icon-wallet"
								   @click="showImportDialog">导入
						</el-button>
					</el-tooltip>
					<el-tooltip class="item" effect="dark" content="发票新增" placement="top-start">
						<el-button size="small" icon="el-icon-document-add" type="primary"
								   @click="insertCompanyClick">发票新增
						</el-button>
					</el-tooltip>
				</el-button-group>
			</div>
			<div>

				<el-table row-key="id" ref="multipleTable" :data="tableData" border :row-key='getRowKeys' :expand-row-keys="expands"
						  @expand-change="expandChange" :height="tableHeight" style="width: 100%;" tooltip-effect="dark">
					<el-table-column type="expand" >
						<el-table :data="tablecolums" border style="width:100%;" :row-style="{height:'6px'}" :cell-style="{padding: '6px'}">
							<el-table-column prop="billing_type" label="发票类型">
							</el-table-column>
							<el-table-column prop="billing_time" label="日期" >
							</el-table-column>
							<el-table-column prop="billing_number" label="发票数量" >
							</el-table-column>
							<el-table-column prop="operation_type" label="操作类型" >
							</el-table-column>
							<el-table-column prop="billing_person" label="操作员" >
							</el-table-column>
							<el-table-column label="状态">
								<template slot-scope="scope">
									{{scope.row.invoice_status}}
								</template>
							</el-table-column>
							<el-table-column style="height:25px" label="操作">
								<template slot-scope="scope">
									<el-button type="text" @click="updatestate(scope.row)" :disabled="scope.row.invoice_status === '作废'">作废</el-button>
								</template>
							</el-table-column>
						</el-table>
					</el-table-column>
					<el-table-column prop="document_number" label="档案号" width="80">
					</el-table-column>
					<el-table-column prop="compname" label="公司名称" show-overflow-tooltip width="150">
					</el-table-column>
					<el-table-column prop="taxtype" label="类型" >
					</el-table-column>
					<el-table-column prop="remake" label="托管">
					</el-table-column>
					<el-table-column prop="duty_paragraph" label="税号" width="150" show-overflow-tooltip>
					</el-table-column>
					<el-table-column prop="invoice_seal" label="发票章">
					</el-table-column>
					<el-table-column prop="remarks" label="备注" width="150" show-overflow-tooltip>
					</el-table-column>
					<el-table-column prop="status" label="状态" show-overflow-tooltip>
					</el-table-column>
					<el-table-column label="专票">
						<el-table-column label="限额" width="60">
							<template slot-scope="scope">
								{{scope.row.spaecialticket_quota}}万
							</template>
						</el-table-column>
						<el-table-column prop="spaecialticket_number" width="60" label="张数">
						</el-table-column>
					</el-table-column>
					<el-table-column label="电子专票">
						<el-table-column label="限额" width="60">
							<template slot-scope="scope">
								{{scope.row.electronicspaecialticket_quota}}万
							</template>
						</el-table-column>
						<el-table-column prop="electronicspaecialticket_number" label="张数" width="60">
						</el-table-column>
					</el-table-column>
					<el-table-column label="普票">
						<el-table-column label="限额" width="60">
							<template slot-scope="scope">
								{{scope.row.generalticket_quota}}万
							</template>
						</el-table-column>
						<el-table-column prop="generalticket_number" label="张数" width="60">
						</el-table-column>
					</el-table-column>
					<el-table-column label="电子普票">
						<el-table-column label="限额" width="60">
							<template slot-scope="scope">
								{{scope.row.electronicgeneralticket_quota}}万
							</template>
						</el-table-column>
						<el-table-column prop="electronicgeneralticket_number" label="张数" width="60">
						</el-table-column>
					</el-table-column>

					<el-table-column label="操作">
						<template slot-scope="scope" width="150">
							<el-button @click="deleteClick(scope.row)" type="text" size="small" :disabled="scope.row.status === '停止' || scope.row.status === '公司名不存在' ">减票</el-button>
							<el-button @click="insertClick(scope.row)" type="text" size="small" :disabled="scope.row.status === '停止' || scope.row.status === '公司名不存在' ">增票</el-button>
							<el-button @click="editClick(scope.row)" type="text" size="small">编辑</el-button>
						</template>
					</el-table-column>
				</el-table>
				<div style="margin-top: 20px">
					<el-pagination @current-change="handleCurrentPageChange" @size-change="handleSizePageChange" :current-page="queryForm.pageNo" :page-size="queryForm.pagesize"
					 :page-sizes="queryForm.pagesizes" background layout="total,sizes, prev, pager, next" :total="pagetotal">
					</el-pagination>
				</div>
			</div>
		</el-card>
	</el-container>
</el-container>


		<el-dialog :close-on-click-modal="false" title="发票新增" :visible.sync="dialogFormVisible" width="600px" >
			<el-form :model="insertcompany" :rules="invoiceRules" ref="insertcompany" label-position="right" label-width="80px" status-icon >
				<el-form-item label-width="100px" label="公司名称" prop="company">
					<el-autocomplete class="inline-input" v-model="insertcompany.company" :value="insertcompany.company" :fetch-suggestions="querySearch"
									 placeholder="请输入内容" :trigger-on-focus="false" @select="handleSelect" style="width:215px">
					</el-autocomplete>
				</el-form-item>
				<el-form-item label-width="100px" label="托管">
					<el-select v-model="insertcompany.remake" :value="insertcompany.remake" placeholder="请选择" >
						<el-option label="UK托管" value="UK托管"> </el-option>
						<el-option label="白盘托管" value="白盘托管"> </el-option>
						<el-option label="黑盘托管" value="黑盘托管"> </el-option>
						<el-option label="托管无盘" value="托管无盘"> </el-option>
						<el-option label="有盘不托管" value="有盘不托管"> </el-option>
						<el-option label="无盘" value="无盘"> </el-option>
					</el-select>
				</el-form-item>
				<el-form-item label-width="100px" label="发票章">
					<el-select v-model="insertcompany.invoice_seal" placeholder="请选择">
						<el-option label="公司保管" value="公司保管"> </el-option>
						<el-option label="客户保管" value="客户保管"> </el-option>
					</el-select>
				</el-form-item>
				<el-form-item label-width="100px" label="税号" prop="duty_paragraph">
					<el-input v-model="insertcompany.duty_paragraph" style="width:217px;"></el-input>
				</el-form-item>
				<br/>
			</el-form>
			<el-form :inline="true" label-position="right" label-width="80px" ref="insertcompany" :model="insertcompany" status-icon >
				<el-form-item label-width="100px" label="专票" >
					<el-input oninput="value=value.replace(/[^\d]/g,'')" v-model="insertcompany.spaecialticket_number" style="width:150px;" >
						<template slot="append">张</template>
					</el-input>

				</el-form-item>
				<el-form-item label-width="100px" label="限额" >
					<el-input oninput="value=value.replace(/[^\d]/g,'')" v-model="insertcompany.spaecialticket_quota" value="insertcompany.spaecialticket_quota" style="width:150px;" >
						<template slot="append">万元</template>
					</el-input>
				</el-form-item>
			</el-form>

			<el-form :inline="true" label-position="right" label-width="80px"  ref="insertcompany" :model="insertcompany" status-icon >
				<el-form-item label-width="100px" label="电子专票">
					<el-input oninput="value=value.replace(/[^\d]/g,'')" v-model="insertcompany.electronicspaecialticket_number" :value="insertcompany.electronicspaecialticket_number" style="width:150px;" >
						<template slot="append">张</template>
					</el-input>
				</el-form-item>
				<el-form-item label-width="100px" label="限额">
					<el-input oninput="value=value.replace(/[^\d]/g,'')" v-model="insertcompany.electronicspaecialticket_quota" value="insertcompany.electronicspaecialticket_quota" style="width:150px;" >
						<template slot="append">万元</template>
					</el-input>
				</el-form-item>
			</el-form>

			<el-form :inline="true" label-position="right" label-width="80px" ref="insertcompany" :model="insertcompany" status-icon >
				<el-form-item label-width="100px" label="普票">
					<el-input oninput="value=value.replace(/[^\d]/g,'')" v-model="insertcompany.generalticket_number" :value="insertcompany.generalticket_number" style="width:150px;" >
						<template slot="append">张</template>
					</el-input>
				</el-form-item>
				<el-form-item label-width="100px" label="限额" >
					<el-input oninput="value=value.replace(/[^\d]/g,'')" v-model="insertcompany.generalticket_quota" value="insertcompany.generalticket_quota" style="width:150px;" >
						<template slot="append">万元</template>
					</el-input>
				</el-form-item>
			</el-form>

			<el-form :inline="true" label-position="right" label-width="80px" ref="insertcompany" :model="insertcompany" status-icon >
				<el-form-item label-width="100px" label="电子普票">
					<el-input oninput="value=value.replace(/[^\d]/g,'')" v-model="insertcompany.electronicgeneralticket_number" :value="insertcompany.electronicgeneralticket_number" style="width:150px;" >
						<template slot="append">张</template>
					</el-input>
				</el-form-item>
				<el-form-item label-width="100px" label="限额">
					<el-input oninput="value=value.replace(/[^\d]/g,'')" v-model="insertcompany.electronicgeneralticket_quota" value="insertcompany.electronicgeneralticket_quota" style="width:150px;" >
						<template slot="append">万元</template>
					</el-input>
				</el-form-item>
			</el-form>

			<el-form :inline="true" label-position="right" label-width="80px" ref="insertcompany"  status-icon>
				<el-form-item label-width="100px" label="备注">
					<el-input style="width:400px;" type="textarea" autosize placeholder="请输入内容" v-model="insertcompany.remarks">
					</el-input>
				</el-form-item>
			</el-form>

			<div slot="footer" class="dialog-footer">
				<el-button @click="cancelInsert">取 消</el-button>
				<el-button type="primary" @click="insertCompany">确 定</el-button>
			</div>


		</el-dialog>

		<el-dialog :close-on-click-modal="false" title="发票编辑" :visible.sync="dialogEditClick" width="600px">
			<el-form label-position="right" label-width="80px" status-icon >

				<el-form-item label-width="100px" label="公司名称" >
					<el-autocomplete class="inline-input" v-model="updatecompany.compname" :value="updatecompany.compname" :fetch-suggestions="querySearch"
									 placeholder="请输入内容" :trigger-on-focus="false" @select="handleSelect" style="width:215px">
					</el-autocomplete>
				</el-form-item>
				<el-form-item label-width="100px" label="托管">
					<el-select v-model="updatecompany.remake" :value="updatecompany.remake" placeholder="请选择" >
						<el-option label="UK托管" value="UK托管"> </el-option>
						<el-option label="白盘托管" value="白盘托管"> </el-option>
						<el-option label="黑盘托管" value="黑盘托管"> </el-option>
						<el-option label="托管无盘" value="托管无盘"> </el-option>
						<el-option label="有盘不托管" value="有盘不托管"> </el-option>
						<el-option label="无盘" value="无盘"> </el-option>
					</el-select>
				</el-form-item>
				<el-form-item label-width="100px" label="发票章">
					<el-select v-model="updatecompany.invoice_seal" :value="updatecompany.invoice_seal" placeholder="请选择" >
						<el-option label="公司保管" value="公司保管"> </el-option>
						<el-option label="客户保管" value="客户保管"> </el-option>
					</el-select>
				</el-form-item>
				<el-form-item label-width="100px" label="税号">
					<el-input v-model="updatecompany.duty_paragraph" :value="updatecompany.duty_paragraph" style="width:217px;"></el-input>
				</el-form-item>
				<br/>
			</el-form>
			<el-form :inline="true" label-position="right" label-width="80px" :ref="updatecompany" :model="updatecompany" status-icon >
				<el-form-item label-width="100px" label="专票" >
					<el-input oninput="value=value.replace(/[^\d]/g,'')" v-model="updatecompany.spaecialticket_number" :value="updatecompany.spaecialticket_number" disabled style="width:150px;" >
						<template slot="append">张</template>
					</el-input>

				</el-form-item>
				<el-form-item label-width="100px" label="限额" >
					<el-input oninput="value=value.replace(/[^\d]/g,'')" v-model="updatecompany.spaecialticket_quota" :value="updatecompany.spaecialticket_quota" style="width:150px;" >
						<template slot="append">万元</template>
					</el-input>
				</el-form-item>
			</el-form>

			<el-form :inline="true" label-position="right" label-width="80px" :ref="updatecompany" :model="updatecompany" status-icon >
				<el-form-item label-width="100px" label="电子专票" >
					<el-input oninput="value=value.replace(/[^\d]/g,'')" disabled v-model="updatecompany.electronicspaecialticket_number" :value="updatecompany.electronicspaecialticket_number" style="width:150px;" >
						<template slot="append">张</template>
					</el-input>
				</el-form-item>
				<el-form-item label-width="100px" label="限额" >
					<el-input oninput="value=value.replace(/[^\d]/g,'')" v-model="updatecompany.electronicspaecialticket_quota" :value="updatecompany.electronicspaecialticket_quota" style="width:150px;" >
						<template slot="append">万元</template>
					</el-input>
				</el-form-item>
			</el-form>

			<el-form :inline="true" label-position="right" label-width="80px" :ref="updatecompany" :model="updatecompany" status-icon >
				<el-form-item label-width="100px" label="普票">
					<el-input oninput="value=value.replace(/[^\d]/g,'')" disabled v-model="updatecompany.generalticket_number" :value="updatecompany.generalticket_number" style="width:150px;" >
						<template slot="append">张</template>
					</el-input>
				</el-form-item>
				<el-form-item label-width="100px" label="限额">
					<el-input oninput="value=value.replace(/[^\d]/g,'')" v-model="updatecompany.generalticket_quota" :value="updatecompany.generalticket_quota" style="width:150px;" >
						<template slot="append">万元</template>
					</el-input>
				</el-form-item>
			</el-form>

			<el-form :inline="true" label-position="right" label-width="80px" :ref="updatecompany" :model="updatecompany" status-icon>
				<el-form-item label-width="100px" label="电子普票">
					<el-input oninput="value=value.replace(/[^\d]/g,'')" disabled v-model="updatecompany.electronicgeneralticket_number" :value="updatecompany.electronicgeneralticket_number" style="width:150px;" >
						<template slot="append">张</template>
					</el-input>
				</el-form-item>
				<el-form-item label-width="100px" label="限额">
					<el-input oninput="value=value.replace(/[^\d]/g,'')" v-model="updatecompany.electronicgeneralticket_quota" :value="updatecompany.electronicgeneralticket_quota" style="width:150px;" >
						<template slot="append">万元</template>
					</el-input>
				</el-form-item>
			</el-form>

			<el-form :inline="true" label-position="right" label-width="80px" :ref="updatecompany"  status-icon>
				<el-form-item label-width="100px" label="状态">
					<el-select v-model="updatecompany.status" :value="updatecompany.status" placeholder="请选择" >
						<el-option label="正常" value="正常"> </el-option>
						<el-option label="停止" value="停止"> </el-option>
					</el-select>
				</el-form-item>
			</el-form>

			<el-form :inline="true" label-position="right" label-width="80px" :ref="updatecompany"  status-icon>
				<el-form-item label-width="100px" label="备注">
					<el-input style="width:400px;" type="textarea" autosize placeholder="请输入内容" :value="updatecompany.remarks" v-model="updatecompany.remarks">
					</el-input>
				</el-form-item>
			</el-form>

			<div slot="footer" class="dialog-footer">
				<el-button @click="cancelEdit">取 消</el-button>
				<el-button type="primary" @click="editClickUpdate">确 定</el-button>
			</div>
		</el-dialog>

		<el-dialog :close-on-click-modal="false" title="减票" :visible.sync="dialogDeleteClick" width="400px">
			<el-form >
				<el-form-item label-width="100px" label="公司名称">
					<el-input :value="deleteclick.compname" style="width:220px;" disabled></el-input>
				</el-form-item>

				<el-form-item label-width="100px" label="减票类型">
					<el-select v-model="deleteclick.billingType" placeholder="请选择">
						<el-option label="专票" value="专票"> </el-option>
						<el-option label="电子专票" value="电子专票"> </el-option>
						<el-option label="普票" value="普票"> </el-option>
						<el-option label="电子普票" value="电子普票"> </el-option>
					</el-select>
				</el-form-item>

				<el-form-item label-width="100px" label="减票时间">
					<el-date-picker v-model="deleteclick.billingTime" type="date" placeholder="选择日期" format="yyyy 年 MM 月 dd 日" value-format="yyyy-MM-dd"></el-date-picker>
				</el-form-item>

				<el-form-item label-width="100px" label="减票数量(张)">
					<el-input oninput="value=value.replace(/[^\d]/g,'')" v-model="deleteclick.number" style="width:220px;"></el-input>
				</el-form-item>

				<el-form-item label-width="100px" label="操作员" >
					<el-select v-model="deleteclick.billingPerson" value="deleteclick.billingPerson" placeholder="请选择">
						<div v-for="item in users">
							<el-option :label="item.username"> </el-option>
						</div>
					</el-select>
				</el-form-item>
			</el-form>
			<div slot="footer" class="dialog-footer">
				<el-button @click="cancelDeleteClick">取 消</el-button>
				<el-button type="primary" @click="submitDeleteClick">确 定</el-button>
			</div>
		</el-dialog>

		<el-dialog :close-on-click-modal="false" title="增票" :visible.sync="dialogInsertClick" width="400px">
			<el-form >
				<el-form-item label-width="100px" label="公司名称">
					<el-input :value="insertclick.compname" style="width:215px;" disabled></el-input>
				</el-form-item>

				<el-form-item label-width="100px" label="增票类型">
					<el-select v-model="insertclick.billingType" placeholder="请选择">
						<el-option label="专票" value="专票"> </el-option>
						<el-option label="电子专票" value="电子专票"> </el-option>
						<el-option label="普票" value="普票"> </el-option>
						<el-option label="电子普票" value="电子普票"> </el-option>
					</el-select>
				</el-form-item>

				<el-form-item label-width="100px" label="增票时间">
					<el-date-picker v-model="insertclick.billingTime" type="date" placeholder="选择日期" format="yyyy 年 MM 月 dd 日" value-format="yyyy-MM-dd"></el-date-picker>
				</el-form-item>

				<el-form-item label-width="100px" label="增票数量(张)">
					<el-input oninput="value=value.replace(/[^\d]/g,'')" v-model="insertclick.number" style="width:215px;"></el-input>
				</el-form-item>

				<el-form-item label-width="100px" label="操作员" >
					<el-select v-model="insertclick.billingPerson" value="insertclick.billingPerson" placeholder="请选择">
						<div v-for="item in users">
							<el-option :label="item.username"> </el-option>
						</div>
					</el-select>
				</el-form-item>

			</el-form>
			<div slot="footer" class="dialog-footer">
				<el-button @click="cancelInsertClick">取 消</el-button>
				<el-button type="primary" @click="submitInsertClick">确 定</el-button>
			</div>
		</el-dialog>

		<el-dialog :close-on-click-modal="false" title="原件统计表导入" :visible.sync="dialogimportFormVisible" width="500px">
			<el-form  label-width="80px">
				<el-row :gutter="20">
					<el-col :span="24" style="padding-left: 50px;">
						<el-upload
						  class="upload-demo"
						  drag
						  :action="uploadurl"
						  :headers="headers"
						  :before-upload="beforeAvatarUpload"
						  :on-success="handleAvatarSuccess"
							accept=".csv"
						  multiple>
						  <i class="el-icon-upload"></i>
						  <div class="el-upload__text">将文件拖到此处，或<em>点击导入</em></div>
						  <div class="el-upload__tip" slot="tip">
							  只能导入csv文件，且不超过5mb<br>
							  仅支持格式：<br>
							  档案号	名称	类型	是否托管	税号	发票章	专票	专票限额	电子专票	电子专票限额	普票	普票限额	电子普票	电子普票限额	备注	状态<br>
						  </div>
						</el-upload>
					</el-col>
				</el-row>
			</el-form>
		</el-dialog>

</template>
</div>
</body>

<script src="./js/invoicecompany.js?v=0.8.0.3"></script>

</script>
</html>

